package logic;

import java.util.Vector;

public class TexasHoldemPlayer {

	private String name;
	private float moneyLeft;
	private Vector<Card> cardList;
	private float reserved;
	private float lastBet;

	public TexasHoldemPlayer(String name, float money) {
		this.name = name;
		this.moneyLeft = money;		
		reserved = 0.0f;
		cardList = new Vector<Card>();
	}

	public String getName() {
		return name;
	}

	public float getMoneyLeft() {
		return moneyLeft;
	}

	public void addCard(Card card) {
		cardList.add(card);
	}

	public String getCardNames() {
		return cardList.get(0).getName()+" "+cardList.get(1).getName();
	}

	public boolean bet(float f) {
		if(f>moneyLeft)
			return false;
		
		moneyLeft -= f;
		lastBet += f;
		return true;		
	}

	public Vector<Card> getCards() {
		return cardList;
	}

	public void clearCards() {
		cardList.removeAllElements();
	}

	public boolean specialBet(float f) {
		if((f+reserved)>moneyLeft)
			return false;
		
		reserved += f;
		return true;	
	}

	public float getMoneyReserved() {
		return reserved;
	}

	public void restoreReservedMoney() {
		reserved = 0.0f;
	}

	public void spendReservedMoney() {
		moneyLeft -= reserved;
		reserved = 0.0f;
	}

	public void addMoney(float f) {
		moneyLeft += f;
	}

	public float getLastBet() {
		return lastBet;
	}

	public void resetLastBet() {
		lastBet = 0.0f;
	}

}
